65396f
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -33,7 +34,7 @@
  */
 public abstract class InstanceCache<SeedObject, Instance> {
   private static final Log LOG = LogFactory.getLog(InstanceCache.class);
-  HashMap<Integer, Instance> cache = new HashMap<Integer, Instance>();
+  Map<SeedObject, Instance> cache = new HashMap<SeedObject, Instance>();
   
   public InstanceCache() {}
 
@@ -53,15 +54,15 @@
public Instance retrieve(SeedObject hv,
       Set<SeedObject> seenSchemas) throws AvroSerdeException {
     if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString());
 
-    if(cache.containsKey(hv.hashCode())) {
+    if(cache.containsKey(hv)) {
       if(LOG.isDebugEnabled()) LOG.debug("Returning cache result.");
-      return cache.get(hv.hashCode());
+      return cache.get(hv);
     }
 
     if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache");
 
     Instance instance = makeInstance(hv, seenSchemas);
-    cache.put(hv.hashCode(), instance);
+    cache.put(hv, instance);
     return instance;
   }
 
